/**
 * 
 */
package edu.umd.clip.lm.model.data;

import java.io.IOException;
import java.util.*;

/**
 * @author Denis Filimonov <den@cs.umd.edu>
 *
 */
public abstract class TrainingDataReader {
	protected FinishedReadingObservable finishedReadingData;
	
	protected TrainingDataReader() {
		finishedReadingData = new FinishedReadingObservable();
	}
	
	private static class FinishedReadingObservable extends Observable {
		public void finished() {
			setChanged();
		}
	}
	
	public abstract TrainingDataBlock getNextBlock() throws IOException;
	//public abstract boolean canReset();
	//public abstract void reset() throws IOException;
	public abstract void start(ReadableTrainingData data);
	
	//public abstract void finish(ReadableTrainingData data);
	
	public void addFinishedReadingDataObserver(Observer observer) {
		finishedReadingData.addObserver(observer);
	}
	
	void finishedReadingData() {
		finishedReadingData.finished();
		finishedReadingData.notifyObservers();
	}
}